#include "ThreadPool.h"
#include "Task.h"
#include <iostream>
#include <memory>

class PrintTask : public Task {
public:
  explicit PrintTask(int id) : id_(id) {}
  void run() override {
    std::this_thread::sleep_for(std::chrono::seconds(5));
    std::cout << "Task " << id_ << " executed\n";
  }

private:
  int id_;
};

int main() {
  ThreadPool pool;
  pool.start(4);
  pool.setTaskQueMaxThreshold(4);

  for (int i = 0; i < 100; ++i) {
    pool.submitTask(std::make_shared<PrintTask>(i));
  }

  // 示例代码未实现线程池停止逻辑，真实项目请补充 stop() 等接口。
  std::this_thread::sleep_for(std::chrono::milliseconds(100));
  return 0;
}